<template>
    <div>
        <ul>
            <li v-for="(item,i) in product" :key="i">
                {{item.title}} --- 价格：{{item.price}}
                <button>添加购物车</button>
            </li>
        </ul>
    </div>
</template>
<script>
import {mapActions,mapState} from 'vuex'
export default {
    created(){
        this.getProduct();
    },
    computed:{
        ...mapState({
            product:state => state.product.productList
        })
    },
    methods:{
        ...mapActions(['getProduct'])
    }
}
</script>
